//
//  RebateTradeDataVM.swift
//  kxf
//
//  Created by Mac on 2024/3/11.
//

import Foundation
import UIKit

class RebateTradeDataVM: UIView {
    
    let selfHeight = kFitWidth(156)

    override init(frame:CGRect){
        super.init(frame: CGRect.init(x: kFitWidth(1), y: frame.origin.y, width: SCREEN_WIDHT-kFitWidth(2), height: selfHeight))
        self.backgroundColor = .white
        self.isUserInteractionEnabled = true
        self.layer.cornerRadius = kFitWidth(8)
        self.clipsToBounds = true
        
        initUI()
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    lazy var titleVm : RegisterViewHeadTitleVM = {
        let vm = RegisterViewHeadTitleVM.init(frame: .zero)
        vm.titleLabel.text = "交易分润"
        vm.arrowImgView.isHidden = false
        vm.tapView.isHidden = false
        
        return vm
    }()
    lazy var bgImgView : UIImageView = {
        let img = UIImageView()
        img.setImgLocal(imgName: "rebate_img_bg")
        img.isUserInteractionEnabled = true
        
        return img
    }()
    lazy var moneyLabel : UILabel = {
        let lab = UILabel()
        lab.textColor = .THEME
        lab.font = .systemFont(ofSize: 24, weight: .medium)
        lab.text = "344523"
        lab.adjustsFontSizeToFitWidth = true
        
        return lab
    }()
    lazy var tipsLabel : UILabel = {
        let lab = UILabel()
        lab.text = "交易分润—收入总金额"
        lab.textColor = .black
        lab.font = .systemFont(ofSize: 14, weight: .medium)
        
        return lab
    }()
}

extension RebateTradeDataVM{
    func initUI() {
        addSubview(titleVm)
        addSubview(bgImgView)
        bgImgView.addSubview(moneyLabel)
        bgImgView.addSubview(tipsLabel)
        
        setConstrait()
    }
    func setConstrait() {
        bgImgView.snp.makeConstraints { make in
            make.centerX.lessThanOrEqualToSuperview()
            make.width.equalTo(kFitWidth(347))
            make.height.equalTo(kFitWidth(95))
            make.bottom.equalTo(kFitWidth(-11))
        }
        moneyLabel.snp.makeConstraints { make in
            make.left.equalTo(kFitWidth(18))
            make.top.equalTo(kFitWidth(8))
            make.height.equalTo(kFitWidth(34))
            make.width.equalTo(kFitWidth(240))
        }
        tipsLabel.snp.makeConstraints { make in
            make.left.equalTo(kFitWidth(18))
            make.top.equalTo(kFitWidth(44))
        }
    }
}
